package com.iqiyi.pps.epg.core.dao.vod;

import com.iqiyi.pps.epg.api.model.web.vod.TVodEpisodeLog;
import com.iqiyi.pps.epg.api.model.web.vod.TVodLog;
import com.iqiyi.pps.epg.core.dao.base.BaseDao;
import com.iqiyi.pps.epg.core.model.vod.VodEpisodeLog;
import com.iqiyi.pps.epg.core.model.vod.VodLog;
import com.iqiyi.pps.epg.core.utils.DateTimeUtil;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class VodEpisodeLogDao extends BaseDao<VodEpisodeLog> {
    public TVodEpisodeLog transToThrift(VodEpisodeLog tempData) {
        TVodEpisodeLog _TVodLog = new TVodEpisodeLog();
        _TVodLog.setId(tempData.getId());
        _TVodLog.setProgramId(tempData.getProgramId());
        _TVodLog.setUser(tempData.getUser());
        _TVodLog.setType(tempData.getType());
        _TVodLog.setDescr(tempData.getDescription());
        _TVodLog.setAddTime(DateTimeUtil.transLongFormat(tempData.getAddTime().getTime()));
        return _TVodLog;
    }

    public List<TVodEpisodeLog> transToTList(List<VodEpisodeLog> dataList) {
        List<TVodEpisodeLog> resultList = new ArrayList<>();
        TVodEpisodeLog tVodLog = null;
        for (VodEpisodeLog tempData : dataList) {
            tVodLog = transToThrift(tempData);
            resultList.add(tVodLog);
        }
        return resultList;
    }
}
